//
//  TreeDataModel.m
//  EducationAdminClient
//
//  Created by kwsdzjx on 16/6/6.
//  Copyright © 2016年 周佳兴. All rights reserved.
//

#import "TreeDataModel.h"

@implementation TreeDataModel


+(JSONKeyMapper*)keyMapper {
    
    /* 注意JuhuiModel里面需要映射2种类型
     1. 驼峰Camel命名规范
     2. 把author.header_img和author_username要映射到JuhuiModel直接字段里面 */
    JSONKeyMapper *mapper = [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
    // 取得影射的blocks对象
    JSONModelKeyMapBlock modelBlock = mapper.modelToJSONKeyBlock;
    
    // 根据上述的重新创建映射条件
    JSONKeyMapper *newMapper = [[JSONKeyMapper alloc] initWithJSONToModelBlock:nil modelToJSONBlock:^NSString *(NSString *keyName) {
        // 告诉我们影射规律
        if ([keyName isEqualToString:@"T_1_0"]) {
            return @"T_1_0";
        } else if ([keyName isEqualToString:@"proId"]) {
            return @"proId";
        } else if ([keyName isEqualToString:@"pro_en_name"]) {
            return @"pro_en_name";
        } else if ([keyName isEqualToString:@"pro_port"]) {
            return @"pro_port";
        }else if ([keyName isEqualToString:@"pro_show_way"]) {
            
            return @"pro_show_way";
        }else if ([keyName isEqualToString:@"pro_type"]) {
            
            return @"pro_type";
        }else if ([keyName isEqualToString:@"ID"]) {
            
            return @"id";
        }else if ([keyName isEqualToString:@"name"]) {
            
            return @"name";
        }
        return modelBlock(keyName);
    }];
    return newMapper;
    
    
    //return [JSONKeyMapper mapperFromUnderscoreCaseToCamelCase];
}


+(BOOL)propertyIsOptional:(NSString*)propertyName {
    return  YES;
}

@end
